<template>
  <div>
    <div class="hotTitle">国内疫情</div>
    <div class="time">截至{{ desc.createTime | time }}全国数据统计</div>
    <div class="content">
      <van-row>
        <van-col span="8" class="">
          <p class="yesterday">
            较昨日<span class="yesterday1">{{
              desc.currentConfirmedIncr | num
            }}</span>
          </p>
          <p class="yesterday1 strong">
            {{ desc.currentConfirmedCount | toLocale }}
          </p>
          <strong>现存确诊</strong>
        </van-col>
        <van-col span="8">
          <p class="yesterday">
            较昨日<span class="yesterday2">{{
              desc.yesterdaySuspectedCountIncr | num
            }}</span>
          </p>
          <p class="yesterday2 strong">{{ desc.suspectedIncr | toLocale }}</p>
          <strong>境外输入</strong>
        </van-col>
        <van-col span="8">
          <p class="yesterday">
            较昨日<span class="yesterday3">{{ desc.seriousIncr | num }}</span>
          </p>
          <p class="yesterday3 strong">{{ desc.seriousCount | toLocale }}</p>
          <strong>现存无症状</strong>
        </van-col>
      </van-row>
      <van-row>
        <van-col span="8" class="">
          <p class="yesterday">
            较昨日<span class="yesterday4">{{ desc.confirmedIncr | num }}</span>
          </p>
          <p class="yesterday4 strong">{{ desc.confirmedCount | toLocale }}</p>
          <strong>累计确诊</strong>
        </van-col>
        <van-col span="8">
          <p class="yesterday">
            较昨日<span class="yesterday5">{{ desc.deadIncr | num }}</span>
          </p>
          <p class="yesterday5 strong">{{ desc.deadCount | toLocale }}</p>
          <strong>累计死亡</strong>
        </van-col>
        <van-col span="8">
          <p class="yesterday">
            较昨日<span class="yesterday6">{{ desc.curedIncr | num }}</span>
          </p>
          <p class="yesterday6 strong">{{ desc.curedCount | toLocale }}</p>
          <strong>累计治愈</strong>
        </van-col>
      </van-row>
    </div>
  </div>
</template>

<script>
import moment from "moment";
export default {
  name: "MyCovNumber",
  props: ["covInfo"],
  filters: {
    time(val) {
      return moment(val).format("YYYY/MM/DD-h:mm:ss");
    },
    num(val) {
      return (val = val > 0 ? "+" + val : "-" + val);
    },
    toLocale(val) {
      return Number(val).toLocaleString();
    },
  },
  computed: {
    desc() {
      return this.covInfo.result.desc;
    },
  },
};
</script>

<style scoped lang="scss">
.hotTitle {
  margin-top: 0.15rem;
  padding-left: 0.3rem;
  height: 0.25rem;
  line-height: 0.25rem;
  &::before {
    content: "";
    position: absolute;
    left: 0.15rem;
    width: 0.07rem;
    height: 0.25rem;
    background-color: #1989fa;
  }
}
.time {
  color: #999;
  font-size: 12px;
  margin: 0.2rem 0.15rem;
}
.content {
  text-align: center;
  margin: 0.3rem;
  border-radius: 0.08rem;
  padding-top: 0.2rem;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
  .van-col {
    margin-bottom: 0.2rem;
    .yesterday {
      color: #999;
      font-size: 12px;
    }
    .yesterday1 {
      color: #ff5555;
    }
    .yesterday2 {
      color: green;
    }
    .yesterday3 {
      color: #909046;
    }
    .yesterday4 {
      color: purple;
    }
    .yesterday5 {
      color: yellowgreen;
    }
    .yesterday6 {
      color: 1989fa;
    }
    .strong {
      font-weight: 700;
      font-size: 18px;
    }
  }
}
</style>